import 'package:common/base/base_state.dart';
import 'package:common/base/base_stateful_widget.dart';
import 'package:flutter/material.dart';
import 'package:get/get_rx/src/rx_types/rx_types.dart';
import 'package:get/get_state_manager/src/rx_flutter/rx_obx_widget.dart';
import 'package:resource/generated/l10n.dart';

class OrganizationPage extends BaseStatefulWidget {
  const OrganizationPage({super.key});

  @override
  State<OrganizationPage> createState() => _OrganizationPageState();
}

class _OrganizationPageState extends BaseState<OrganizationPage> {
  RxInt count = 0.obs;

  @override
  bool onNeedCachePage() {
    return true;
  }

  @override
  void onStateInit() {
    rxTitle.value = S.current.organization;
  }

  @override
  bool onNeedBack() {
    return false;
  }

  @override
  Widget onBodyCreate() {
    return Container(
      color: Colors.grey[100],
      child: Center(
        child: InkWell(onTap: () {}, child: Obx(() => Text("$count"))),
      ),
    );
  }

  @override
  Widget? onFloatingActionButton() {
    return FloatingActionButton(onPressed: (){
     increment();
    }, child: const Icon(Icons.add));
  }

  increment() => count++;

  @override
  void onLoadData() {}

  @override
  void onSuccess<D>(D d, String apiPath) {
    super.onSuccess(d, apiPath);
  }
}
